import { defineStore } from "pinia";
import { ref } from "vue";

export const useAddressStore = defineStore( 'addressData', ( ) => {
	const consigneeInfo = ref( {
		consigneeName: '', //收货人姓名
		telNumber: '', //收货人联系方式
		addressData: '' //收货人详细地址
	} )

	// 更新收货信息
	const updateConsigneeInfo = ( info ) => {
		consigneeInfo.value = info
	}

	// 重置收货信息
	const resetConsigneeInfo = ( ) => {
		consigneeInfo.value = {
			consigneeName: '',
			telNumber: '',
			addressData: ''
		}
	}

	return {
		consigneeInfo,
		updateConsigneeInfo,
		resetConsigneeInfo
	}
} )